<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
test(() => assert_selection(
    [
        '<div contenteditable>',
            'First p^aragraph',
            '<div style="border: 1px solid red;">',
                'This |text should be surrounded by a red border.',
            '</div>',
        '</div>',
    ].join(''),
    'insertHTML ABC<div style="border: 1px solid blue;">DEF</div>',
    [
        '<div contenteditable>',
            'First pABC',
            '<div style="border: 1px solid red;">',
                'DEF|text should be surrounded by a red border.',
            '</div>',
        '</div>',
    ].join('')),
    'Merge the last pargraph of incoming fragment into end');
</script>
